Dynamic Code Manager Library Objects
This topic provides information about the library functions which can be used to execute the .NET (C# and Visual Basic) code dynamically. With the dynamic code execution libraries, the C# or VB code is compiled and executed when Real-Time Client runs.
Note: You MUST copy your third-party dlls to the location where RT Designer is installed.
For more information about working with the Dynamic Code Manager, see Working with Dynamic Code Execution Functions.
To use dynamic code execution in RT Designer, the following libraries are added as project references:
Direct.Scripting.dll
Direct.RemoteLoader.dll
To use the library, basic knowledge of the C# and/or VB languages is required.
Function / Event |
Return Value |
Description |
Syntax |
Execute Code | Text |
Executes a block of code. The function can accept any number of parameters that must be referenced via a list of parameters. In addition, a corresponding list of the types of the parameters must be specified. Currently parameters of type string, number/int, boolean, and decimal are supported. Passing parameters is not mandatory. The function is able to execute a simple piece of code that does not have any parameters. While executing C# code, a return statement must be added in the code. If you do not want to return anything, add the following statement return null; Example: string name = "Nice Systems"; MessageBox.Show("Hello World" + name); return null; Example: Parameters can be accessed dynamically in the following way: string name = (string) Parameters[0]; MessageBox.Show("Hello World" + name); return (object) DateTime.Now; |
Execution of DynamicCodeManager <Code> with parameters [<paramsForMethod>] [<paramTypes>] |
Execute Method | Text |
Executes a method. The function can accept any number of parameters that must be referenced via a list of parameters. In addition, a corresponding list of the types of the parameters must be specified. Currently parameters of type string, number/int, boolean, and decimal are supported. While executing C# code, a return statement must be added in the code. If you do not want to return anything, add the following statement return null; Multiple methods can be passed: public int Test(string name, int x) { MessageBox.Show("Hello World",name); return getsquare(x); } public int getsquare(int x) { return x*x; } |
Executes the method of DynamicCodeManager <Code> with method name <MethodName> and parameters [<paramsForMethod>] [<paramTypes>] |
Set language |
None |
Sets the scripting language property. Supported values:
|
Set language of DynamicCodeManager <Language> |
Execute Code Parameters
Parameter |
Type |
Description |
Code |
Text |
Code to be executed dynamically. |
MethodName |
Text |
Name of the method to be executed. |
paramsForMethod |
List of Text |
A list of parameter values accepted by the code. Currently string, number/int, boolean, and decimal values are supported. |
paramTypes |
List of Text |
A list of the parameters accepted by the code. String/string: For String type parameter. Bool/bool: For Boolean type parameter. Int/int: For integer/Number type parameter. Decimal/decimal: For Decimal type parameter. |
Execute Method Parameters
Name |
Type |
Description |
ScriptingLanguage |
Text |
Property specifying code that will be executed dynamically. Supported values:
|
MethodName |
Text |
Name of the method to be executed. |
paramsForMethod |
List of Text |
A list of the parameter values accepted by the code. Currently string, number/integer, boolean, and decimal values are supported. |
paramTypes |
List of Text |
A list of the corresponding parameter types: String/string: For string type parameter. Bool/bool: For Boolean type parameter. Int/int: For integer/Number type parameter. Decimal/decimal: For Decimal type parameter. |